package com.woniuxy.carrental.xileitest;

import com.woniuxy.carrental.entity.*;
import com.woniuxy.carrental.mapper.*;
import com.woniuxy.carrental.service.PurchaseService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @author xilei
 * @create 2021-09-28 下午 3:39
 */
@SpringBootTest
public class Daotest {

    @Resource
    SupplierMapper supplierMapper;
    @Resource
    CarMapper carMapper;
    @Resource
    CarpartMapper carpartMapper;
    @Resource
    Supply_carMapper supply_carMapper;
    @Resource
    Supply_partMapper supply_partMapper;
@Resource
PurchaseMapper purchaseMapper;
@Resource
PurchaseService purchaseService;
    @Resource
    CarOrderMapper carOrderMapper;

    @Test
    void test01(){
//        CarOrder order = carOrderMapper.selectCarOrderByOrder_id("123123");
//        System.out.println(order);
        //供应商测试代码//
//        Supplier supplier = new Supplier(1, "孤傲园", "成都市太平路188号", "13233334444", "主营红旗及通用汽配");
//        supplierMapper.insertSupplier(supplier);
//        List<Supplier> supplier = supplierMapper.findSupplier();
//        List<Supplier> supplierByPage = supplierMapper.findSupplierByPage(1, 5);
//        List<Supplier> qqq = supplierMapper.findSupplierByPageByParam("孤傲",null,null,null,1,5);
//        supplierMapper.updateSupplier("孤傲园","成都市太平路189号","13233334444","主营红旗轿车及通用汽配",1);
//        System.out.println(qqq);
        //车测试代码//
//        Car car = new Car(1, "五菱宏光", "小轿车", "MINIEV__2021款 马卡龙时尚款 磷酸铁锂","classpath:\\static\\红旗E-HS9__2020 款 旗·领 四座版.jpg");
//        carMapper.insertCar(car);
//        carMapper.updateCar("五菱宏光", "小轿车", "MINIEV__2021款 马卡龙时尚款 磷酸铁锂", "classpath:\\static\\红旗E-HS9__2020 款 旗·领 四座版.jpg", 1);
//        List<Supplier> car = carMapper.findCar();
//        System.out.println(car);
        //汽配测试代码//
//        Carpart carpart = new Carpart(1,"机油泵","丰田专用汽配","15100-97401","classpath:\\static\\15100-97401 机油泵 适用于 丰田.jpg");
//        carpartMapper.insertCarpart(carpart);
//        carpartMapper.updateCarpart("机油泵丰田专用","丰田专用汽配","15100-97401","classpath:\\static\\15100-97401 机油泵 适用于 丰田.jpg",1);
//        List<Carpart> list = carpartMapper.findCarpartBypageByparm("机油泵", null, null, 1, 5);
//        System.out.println(list);
//        List<Supply_car> supply_carList = supply_carMapper.findSupply_car();
//        System.out.println(supply_carList);
        //车辆关系表supply_car测试代码//
//        List<Supply_car> bySupplier = supply_carMapper.findSupply_carBysupplier_id(4);
//        List<Supply_car> supply_carBycar_id = supply_carMapper.findSupply_carBycar_id(1,5);
//        List<Supply_car> list = supply_carMapper.findSupply_carBy(1, 5, 10);
//        for(Supply_car a:list){
//            System.out.println(a);
//        }
        //汽配关系表supply_part测试代码//
//        List<Supply_part> list = supply_partMapper.findSupply_part();
//        List<Supply_part> list = supply_partMapper.findSupply_partBycarpart_id(1,5,2);
//        List<Supply_part> list = supply_partMapper.findSupply_partBysupplier_id(2);
//        for(Supply_part a:list){
//            System.out.println(a);
//        }
        //采购表Purchase测试代码//
//        List<Purchase> list = purchaseMapper.findPurchaseBypurchase_id("1");
//        for(Purchase a:list){
//            System.out.println(a);
//        }
//        Purchase purchase = new Purchase(null, null , "111", "111", "111", 111, 111, 111, 111);
        purchaseMapper.insertPurchase("2",null,null, null, "11", 1, null,null , 100,true);
//        List<Purchase> list = purchaseMapper.findPurchase();
//        for(Purchase a:list){
//                System.out.println(a);
//        }
//        purchaseMapper.deletePurchase("09EE6CED066548519BDE02D9396248E2");
//        purchaseService.deletePurchase("AC191F2EC2D84BFB9B83D54D5C076E63");
//        Purchase(purchase_id=null, purchase_date=null, car_name=null, carpart_name=null, supplier_name=null, car_count=1, part_count=null, part_allsprice=null, car_allsprice=300000,
//                car=Car(car_id=2, car_name=宝马3系__2022 款, car_type=null, car_vehicle=null, car_picture=null, suppliers=null),
//                carpart=null,
//                supplier=Supplier(supplier_id=null, supplier_name=王五旗舰店, supplier_address=null, supplier_telephone=null, supplier_contant=null, car=null, carpart=null),
//                supply_car=null,
//                supply_part=null);
    }
}
